Hệ thống quản lý phòng khám trực tuyến bằng PHP
1 <?php
2 $currDir = dirname(__FILE__);
3 require("{$currDir}/incCommon.php");
4 $GLOBALS['page_title'] = $Translation['rebuild thumbnails'];
5 include("{$currDir}/incHeader.php");
6
7 // image paths
8 $p=array(
9 'patients' => array(
10 'image' => '../images/'
11 ),
12 'medical_records' => array(
13 'image_1' => '../images/',
14 'image_2' => '../images/',
15 'image_3' => '../images/',
16 'image_4' => '../images/',
17 'image_5' => '../images/'
18 )
19 );
20
21 if(!count($p)) exit;
22
23 // validate input
24 $t=$_GET['table'];
25 if(!in_array($t, array_keys($p))){
26 ?>
27 <div class="page-header"><h1><?php echo $Translation['rebuild thumbnails']; ?></h1></div>
28 <form method="get" action="pageRebuildThumbnails.php" target="_blank">
29 <?php echo $Translation['thumbnails utility']; ?><br><br>
30
31 <b><?php echo $Translation['rebuild thumbnails of table'] ; ?></b>
32 <?php echo htmlSelect('table', array_keys($p), array_keys($p), ''); ?>
33 <input type="submit" value="<?php echo $Translation['rebuild'] ; ?>">
34 </form>
35
36
37 <?php
38 include("{$currDir}/incFooter.php");
39 exit;
40 }
41
42 ?>
43 <div class="page-header"><h1><?php echo str_replace ( "<TABLENAME>" , $t , $Translation['rebuild thumbnails of table_name'] ); ?></h1></div>
44 <?php echo $Translation['do not close page message'] ; ?><br><br>
45 <div style="font-weight: bold; color: red; width:700px;" id="status"><?php echo $Translation['rebuild thumbnails status'] ; ?></div>
46 <br>
47
48 <div style="text-align:left; padding: 0 5px; width:700px; height:250px;overflow:auto; border: solid 1px green;">
49 <?php
50 foreach($p[$t] as $f=>$path){
51 $res=sql("select `$f` from `$t`", $eo);
52 echo str_replace ( "<FIELD>" , $f , $Translation['building field thumbnails'] )."<br>";
53 unset($tv); unset($dv);
54 while($row=db_fetch_row($res)){
55 if($row[0]!=''){
56 $tv[]=$row[0];
57 $dv[]=$row[0];
58 }
59 }
60 for($i=0; $i<count($tv); $i++){
61 if($i && !($i%4)) echo '<br style="clear: left;">';
62 echo '<img src="../thumbnail.php?t='.$t.'&f='.$f.'&i='.$tv[$i].'&v=tv" align="left" style="margin: 10px 10px;"> ';
63 }
64 echo '<br style="clear: left;">';
65
66 for($i=0; $i<count($dv); $i++){
67 if($i && !($i%4)) echo '<br style="clear: left;">';
68 echo '<img src="../thumbnail.php?t='.$t.'&f='.$f.'&i='.$tv[$i].'&v=dv" align="left" style="margin: 10px 10px;"> ';
69 }
70 echo "<br style='clear: left;'>{$Translation['done']}<br><br>";
71 }
72 ?>
73 </div>
74
75 <script>
76 window.onload = function(){
77 document.getElementById('status').innerHTML = "<?php echo $Translation['finished status'] ; ?>";
78 document.getElementById('status').style.color = 'green';
79 document.getElementById('status').style.fontSize = '25px';
80 document.getElementById('status').style.backgroundColor = '#fff4cf';
81 }
82 </script>
83
84 <?php
85 include("{$currDir}/incFooter.php");